#ifndef ADDTICKETDIALOG_H
#define ADDTICKETDIALOG_H

#include <QDialog>
#include <QJsonObject>

class QLineEdit;
class QComboBox;
class QDoubleSpinBox;
class QSpinBox;
class QLineEdit;
class QTimeEdit;
class QPushButton;

class AddTicketDialog : public QDialog
{
    Q_OBJECT

public:
    explicit AddTicketDialog(const QString& ticketType = "", QWidget *parent = nullptr);
    ~AddTicketDialog();
    
    QJsonObject getTicketParams() const;
    QString getTicketId() const;

private slots:
    void onOkClicked();
    void onCancelClicked();
    void onTicketTypeChanged();

private:
    void setupUI();
    void setupConnections();
    void generateDefaultTicketId();
    bool validateInput();
    
    QLineEdit *ticketIdEdit;
    QLineEdit *ticketNameEdit;
    QComboBox *ticketTypeCombo;
    QLineEdit *departureLocationEdit;
    QLineEdit *arrivalLocationEdit;
    QDoubleSpinBox *priceSpinBox;
    QSpinBox *stockSpinBox;
    QComboBox *statusCombo;
    QTimeEdit *departureTimeEdit;
    QTimeEdit *arrivalTimeEdit;
    QLineEdit *trainNumberEdit;
    
    QPushButton *okButton;
    QPushButton *cancelButton;
    
    QString currentTicketType;
};

#endif // ADDTICKETDIALOG_H